﻿@using Microsoft.AspNetCore.Components.Rendering
@namespace Microsoft.FluentUI.AspNetCore.Components

@if (_internalDialogContext.References.Any())
{
    <CascadingValue TValue="InternalDialogContext" IsFixed="true" Value = "@_internalDialogContext" >
        @_renderDialogs
    </CascadingValue>
}


@code {
    protected void RenderDialogs(RenderTreeBuilder __builder)
    {
        @foreach (DialogReference dialog in _internalDialogContext.References)
        {
            <FluentDialog @key="@dialog" Id="@dialog.Id" Instance="@dialog.Instance" Data="@dialog.Instance.Content" @ondialogdismiss=OnDismissAsync />
        }
    }
}